package com.chenjian.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chenjian.entity.Sources;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author chenjian
 * @since 2020-04-13
 */
public interface SourcesMapper extends BaseMapper<Sources> {

    @Select(value = "SELECT id, module_id, sources_name, sources_info, create_time, update_time, version FROM sources WHERE module_id in (SELECT id FROM module WHERE user_id = (SELECT id FROM user WHERE id = #{id} AND deleted = 1) and deleted = 1) and deleted = 1 ORDER BY id asc LIMIT #{page},#{size}")
    List<Sources> getSourcesByUserId(Long id,Integer page,Integer size);
}
